package com.open.source.kafka;

import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.springframework.kafka.listener.ContainerProperties;
import org.springframework.kafka.listener.ContainerProperties.AckMode;

/**
 * 自动提交
 *
 * @author ZonLen since on 2022/7/29 下午12:22
 */

@Slf4j
public abstract class AbstractKafkaAutoCommitConsumerListener extends
    AbstractKafkaConsumerListener {

  @Override
  protected void configureConsumer(ContainerProperties containerProperties) {
    containerProperties.setAckMode(AckMode.BATCH);
    containerProperties.getKafkaConsumerProperties()
        .put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, true);
  }

}
